//
//  ForWordStatusCell.swift
//  MyWeibo
//
//  Created by tanchao on 15/8/9.
//  Copyright © 2015年 chaoren. All rights reserved.
//

import UIKit

class ForWordStatusCell: StatusCell {
    override var status:Status?{
        didSet{
            let name = status?.retweeted_status?.user?.name ?? ""
            let text = status?.retweeted_status?.text ?? ""
            forwordLabel.text = "@" + name + ":" + text
        }
    }
    override func prepareUI() {
        super.prepareUI()
        pictureView.backgroundColor = UIColor(white: 0.9, alpha: 1)
         contentView.insertSubview(backButton, belowSubview: pictureView)
        contentView.insertSubview(forwordLabel, aboveSubview: backButton)
        backButton.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: contentLabel, size: nil, offset: CGPoint(x:  -StatusCellControlMargin, y: StatusCellControlMargin))
        backButton.ff_AlignVertical(type: ff_AlignType.TopRight, referView: bottomView, size: nil)
        forwordLabel.ff_AlignInner(type: ff_AlignType.TopLeft, referView: backButton, size: nil,offset: CGPoint(x: StatusCellControlMargin, y: StatusCellControlMargin))
        
        
        let cons = pictureView.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: forwordLabel, size: CGSize(width: 290, height: 290), offset: CGPoint(x: 0, y: StatusCellControlMargin))
        // 配图视图宽度
        pictureViewConsWidth = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Width)
        // 配图视图高度
        pictureViewConsHeight = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Height)
        pictureViewConsTop = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Top)
    }

 // MARK:- 懒加载控件
    /// 转发文本
    private lazy var forwordLabel:UILabel = UILabel(text_Color: UIColor.darkGrayColor(), font_Size: 14, number_OfLines: 0, preferredMaxWidth: UIScreen.mainScreen().bounds.width - 2 * StatusCellControlMargin)
    /// 背景按钮
    private lazy var backButton : UIButton = {
        let btn = UIButton()
        btn.backgroundColor = UIColor(white: 0.9, alpha: 1)
        return btn
    }()
}
